<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>02设置最大和最小缩放级别</title>
  <link rel="stylesheet" href="../ol/ol.css">
  <style>
    html, body {
      margin: 0;
    }
    #map {
      position: absolute;
      top: 0;
      bottom: 0;
      width: 100%;
    }
  </style>
</head>
<body>
<div id="map"></div>

<script src="../ol/ol.js"></script>
<script>
  const map = new ol.Map({
    target: 'map',
    layers: [
      new ol.layer.Tile({
        source: new ol.source.OSM()
      })
    ],
    view: new ol.View({
      center: [113.267252, 23.137949], // 设置视图中心点
      projection: 'EPSG:4326', // 配置投影坐标系
      zoom: 12, // 默认缩放级别
      minZoom: 10, // 设置最小缩放级别
      maxZoom: 14, // 设置最大缩放级别
    })
  })
</script>
</body>
</html>